home *** CD-ROM | disk | FTP | other *** search
-
- /* outtext.c---outtext, p 845 */
- #include <graphics.h>
- char title[] = "Turboc C Graphics Window";
- main()
- {
- int graphdriver = DETECT, graphmode, xmax, ymax, xsize, ysize;
- /* DetecT and initialize graphics system */
- initgraph(&graphdriver, &graphmode, "c:\\turboc");
- /* Display a graphics window with a title */
- xmax = getmaxx();
- ymax = getmaxy();
- xsize = xmax - 100;
- ysize = ymax - 60;
- setviewport(50, 30, xsize+50, ysize+30,1);
- setfillstyle(SOLID_FILL, RED);
- setcolor(YELLOW);
- bar3d(0,0,xsize,ysize,0,1);
- /* Draw title bar and print title with outtext */
- settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 1);
- settextjustify(LEFT_TEXT, BOTTOM_TEXT);
- rectangle(0,0,xsize,textheight("H")+4);
- moveto((xsize-textwidth(title))/2, textheight("H"));
- outtext(title);
- /* Wait until a key is pressed */
- moveto(10, ysize-10);
- outtext("Press any key to exit\n");
- getch();
- closegraph(); /* Exit graphics library */
- }